package org.sport.repository;

import org.sport.model.entityModel.GrouptableEntity;
import org.sport.model.entityModel.UsertableEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Repository
public interface GrouptableRepository extends JpaRepository<GrouptableEntity,Integer> {


    @Transactional
    @Query("select gro from GrouptableEntity gro where gro.theam =?1")
    public List<GrouptableEntity> findByTheam(String theam);



    @Transactional
    @Query("select gro from GrouptableEntity gro where gro.usertableByOwnerId =?1")
    public List<GrouptableEntity> findByOwner(UsertableEntity usertableEntity);



    @Transactional
    @Query("select gro from GrouptableEntity gro where gro.title =?1")
    public List<GrouptableEntity> findByTitle(String title);
}
